package com.renshine.base.dao;

import java.util.List;

import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Repository;

import com.renshine.base.bean.Field;
import com.renshine.base.bean.Table;
import com.renshine.base.util.PropertyUtil;

@Repository
@CacheConfig
public class QueryDaoImpl extends AbstractQueryDao {

	@Override
	@Cacheable(key = "tables")
	public List<Table> queryTables() {
		return this.query(PropertyUtil.get("sql.tables"), this.tableRowMapper, PropertyUtil.get("db.name"));
	}

	@Override
	@Cacheable(key = "#tbName")
	public List<Field> queryFields(String tbName) {
		return this.query(PropertyUtil.get("sql.fields"), this.fieldRowMapper, tbName, PropertyUtil.get("db.name"));
	}
	
}
